package cn.fl.ref.fribaseinfo.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.project.service.IPrjCstCorpTeamResumeService;
import cn.fl.ref.fribaseinfo.service.IFundRasInsRlPsnService;
import cn.fl.ref.fribaseinfo.transform.FundRasInsRlPsnVOTransform;
import cn.fl.ref.fribaseinfo.vo.FundRasInsRlPsnVO;
import fl.ref.fribaseinfo.condition.FundRasInsRlPsnQueryCondition;
import fl.ref.fribaseinfo.service.IFundRasInsRlPsnApiService;

/**
 * @Description: 金融机构关联人员信息
 */
@Service
public class FundRasInsRlPsnServiceImpl implements IFundRasInsRlPsnService {

	private static final Logger logger = LoggerFactory.getLogger(FundRasInsRlPsnServiceImpl.class);

	@Autowired
	private IFundRasInsRlPsnApiService fundRasInsRlPsnApiService;

	@Override
	public Long add(FundRasInsRlPsnVO entity) throws BaseException {
		if (null == entity) {
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600_NAME);
		}

		Long id = fundRasInsRlPsnApiService.add(FundRasInsRlPsnVOTransform.toDTO(entity));

		// 系统日志-有用户的情况下
		BaseLogUtils.info(logger, "add", "新增FundRasInsRlPsn数据.", CurrentThreadContext.getCurrentUserName());
		return id;
	}

	@Override
	public boolean modify(FundRasInsRlPsnVO entity) throws BaseException {
		if (null == entity) {
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600_NAME);
		}

		return this.fundRasInsRlPsnApiService.modify(FundRasInsRlPsnVOTransform.toDTO(entity));
	}

	@Override
	public List<FundRasInsRlPsnVO> searchList(FundRasInsRlPsnQueryCondition condition) {
		return FundRasInsRlPsnVOTransform.toVOList(this.fundRasInsRlPsnApiService.searchList(condition));
	}

}
